﻿
@{
    ViewBag.Title = "Index";
}

@{
    ViewBag.PageTitle = "Quản lý sản phẩm";
    ViewBag.PageControls = new List<ControlType>
    {
        ControlType.Create
    };
}

@using Cnm.Models
@using Cnm.Models.Admins
@using Kendo.Mvc.UI
           
@(
 Html.Kendo()
        .Grid<Product>()
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(c => c.Id);
            columns.Bound(c => c.Name);
            columns.Bound(c => c.Alias);
            columns.Bound(c => c.Id).
                ClientTemplate(
                    "<div class='btn-group'>"
                    + "<a class='btn btn-info btn-sm' href='" + Url.Action("Edit") + "?id=#=Id#'><i class='fa fa-edit'></i> Sửa</a>"
                    + "<a class='btn btn-danger btn-sm' onclick=\"DeleteConfirm('" + Url.Action("Delete") + "?id=#=Id#')\"><i class='fa fa-trash-o'></> Xóa</a>"
                    + "</div>")
                .HtmlAttributes(new { @class = "text-center" })
                .Title("Xóa")
                .Sortable(false)
                .Width(150).Filterable(false);
        })
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true))
        .Sortable()
        .DataSource(dataSource => dataSource
        .Ajax()
        .ServerOperation(true)
                        .Read(read => read.Action("GetProductsViewModel", "MngProduct"))
        )
      )
